<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="pojo.SysUser" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>demo</title>
</head>
<body>
<%
    SysUser sysUser = new SysUser(0,"小明",19);
    request.setAttribute("sysUser",sysUser);

    SysUser sysUser1 = new SysUser(1,"小郭",20);
    SysUser sysUser2 = new SysUser(2,"小李",18);
    List<SysUser> list = new ArrayList<>();
    list.add(sysUser1);
    list.add(sysUser2);
    request.setAttribute("list", list);

    Map<String,SysUser> map = new HashMap<>();
    map.put("one", sysUser1);
    map.put("two", sysUser2);
    request.setAttribute("map", map);

    request.setAttribute("num1", 100);
    request.setAttribute("num2", 200);


%>
<%--数据是对象  key.属性名   默认会调用对应属性的get方法--%>
<p>id:${sysUser.id}</p>
<p>name:${sysUser.name}</p>
<p>age:${sysUser.age}</p>
<hr/>
<%--数据是集合或者数组时，通过下标--%>
<p>id:${list[0].id}</p>
<p>name:${list[0].name}</p>
<p>age:${list[0].age}</p>
<p>id:${list[1].id}</p>
<p>name:${list[1].name}</p>
<p>age:${list[1].age}</p>
<hr/>
<%--数据是map,根据key取值即可--%>
<p>map.1.id:${map.one.id}</p>
<p>map.1.name:${map.one.name}</p>
<p>map.1.age:${map.one.age}</p>
<p>map.2.age:${map.two.id}</p>
<p>map.2.age:${map.two.name}</p>
<p>map.2.age:${map.two.age}</p>
<hr/>
<%--el可以取值，也可以运算、逻辑运算--%>
<p>num1 + num2 =${num1+num2}</p>
<p>num1 == num2 ?${num1==num2}</p>
<hr/>
<%--判断是否为空--%>
${num1 == null || num1 == ""}
${empty num1}
<%--实际中，数组、集合、map需要遍历  所以学习jstl--%>
</body>
</html>
